package com.ruoyi.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.domain.entity.AboutUsSection;
import com.ruoyi.system.mapper.AboutUsSectionMapper;
import com.ruoyi.system.service.IAboutUsSectionService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author linxz
 * @since 2025-01-07
 */
@Service
public class AboutUsSectionServiceImpl extends ServiceImpl<AboutUsSectionMapper, AboutUsSection> implements IAboutUsSectionService {

    @Override
    public List<AboutUsSection> getList() {
        return baseMapper.getList();
    }

    @Override
    public int add(AboutUsSection aboutUsSection) {
        List<AboutUsSection> list=baseMapper.isMulti(aboutUsSection.getSection());
        if(list==null || list.size()==0){
            //不重复，可以添加
            return baseMapper.add(aboutUsSection);
        }else {
            return 0;
        }

    }

    @Override
    public int update(AboutUsSection aboutUsSection) {
        return baseMapper.update(aboutUsSection);
    }

    @Override
    public int delete(int id) {
        return baseMapper.delete(id);
    }
}
